<select th:fragment="select(name,default,datas,value)" id="${name}" th:name="${name}" class="selectpicker">
    <option value="">[[${default}]]</option>
    <option th:each="item : ${datas}" th:value="${item.id}" th:text="${item.name}"></option>
</select>
<!--default:默认选择名称；datas:必须为List，并且包含id,name属性，values:默认值-->
<select th:fragment="selectMultiple(name, default, datas, values)" th:id=${name}
        th:name="${name}" class="selectpicker" multiple th:title="${default}">
    <option value="">[[${default}]]</option>
    <option th:each="item : ${datas}" th:value="${item.id}" th:text="${item.name}"
            th:attr="selected=${#arrays.contains(values, #strings.toString(item.id))}?'selected':'false'"></option>
</select>

<div th:fragment="checkbox(name,label,id,value)" class="checkbox-nice">
    <input type="checkbox" th:name="${name}" th:id="${id}" th:attr="checked=${(value!=0)?'checked':'false'}" value="1">
    <label th:for="${id}" th:text="${label}"></label>
</div>

<ul th:fragment="pagination(pageUrl, pages)" class="pagination pull-right" th:if="${pages.getTotalPages() > 0}">
    <li th:if="${pages.hasPrevious()}">
        <a th:href=${pageUrl}+@{page=}+${pages.getNumber()}><i class="fa fa-chevron-left"></i></a>
    </li>
    <li th:each="pg : ${#numbers.sequence(1, pages.totalPages)}"
        th:class="${pg == pages.getNumber()+1}?'active':''">
        <a th:href=${pageUrl}+@{page=}+${pg} th:text="${pg}"></a>
    </li>
    <li th:if="${pages.hasNext()}">
        <a th:href=${pageUrl}+@{page=}+${pages.getNumber()+2}><i class="fa fa-chevron-right"></i></a>
    </li>
</ul>

<span th:fragment="status(value)">
    <span class="label label-success" th:if="${value == 1}">启用</span>
    <span class="label label-warning" th:if="${value != 1}">禁用</span>
</span>

<a th:fragment="view_item(url,title)" href="javascript:;"
   th:attr="data-url=${url}, data-title=${title}" class="table-link md-trigger" target="_blank">
                                <span class="fa-stack">
                                    <i class="fa fa-square fa-stack-2x"></i>
                                    <i class="fa fa-search-plus fa-stack-1x fa-inverse"></i>
                                </span>
</a>
<a th:fragment="edit_item(url,title)" href="javascript:;"
   th:attr="data-title=${title}, data-url=${url}"
   class="table-link md-trigger">
                                    <span class="fa-stack">
                                    <i class="fa fa-square fa-stack-2x"></i>
                                    <i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
                                    </span>
</a>

<a th:fragment="delete_item(url,title,report_message)" href="javascript:;" th:attr="data-html=${report_message}, data-title=${title},
                        data-url=${url}"
   class="table-link is_confirm danger" data-modal="alert">
                                    <span class="fa-stack">
                                    <i class="fa fa-square fa-stack-2x"></i>
                                    <i class="fa fa-trash-o fa-stack-1x fa-inverse"></i>
                                    </span>
</a>

<div th:fragment="inputField(label, name, value)" class="form-group">
    <label class="col-sm-2 control-label" th:text="${label}">Label</label>
    <div class="col-sm-10">
        <input type="text" class="form-control" th:name="${name}" th:value="${value}" th:id="${name}"/>
    </div>
</div>